# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer:
pkgname=delve
pkgver=1.9.0
pkgrel=0
pkgdesc="Debugger for the Go programming language"
url="https://github.com/go-delve/delve"
arch="x86 x86_64 aarch64"
license="MIT"
makedepends="go"
options="net chmod-clean"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/go-delve/delve/archive/refs/tags/v$pkgver.tar.gz"

export GOPATH="$srcdir"

build() {
	mkdir bin
	go build -v -trimpath -o bin ./cmd/dlv/...
}

check() {
	# TestGeneratedDoc and TestBuild require a proper $GOPATH setup.
	go test -run '!(^(TestGeneratedDoc|TestBuild)$)' ./cmd/dlv/...
}

package() {
	install -Dm755 bin/* -t "$pkgdir"/usr/bin/

	# Install additional documentation files.
	mkdir -p "$pkgdir"/usr/share/doc/$pkgname
	cp -r Documentation/* "$pkgdir"/usr/share/doc/$pkgname
}

sha512sums="
7a616281eeb92d07657ed8522672648a993bb54fbe6c8bbea5979cac8f0cff37dfe183950b481a444a20ffa7c95a6a83133356a12ce2894ba0a595d5cacf4100  delve-1.9.0.tar.gz
"
